﻿<form method="post" enctype="multipart/form-data" asp-controller="Upload" asp-action="UploadFiles">
    <div class="form-group">
        <div class="col-md-12">
            <p>选择要上传的文件</p>
            <input type="file" id="files" name="files" multiple />
            <button id="sel" type="button">看选择了什么</button>
            <button id="del" type="button">删除</button>
        </div>
    </div>
    <div id="list"></div>
    <div class="form-group">
        <div class="col-md-12">
            <input type="submit" value="上传" />
        </div>
    </div>
    <a href="/Upload/UploadFiles">已上传文件列表</a>
</form>
@section Scripts {
    <script>
        $(function () {
            $('#sel').click(function () {

                console.log(document.getElementById('files').files[0]);

                console.log("--");

                var fs = $('#files').get(0).files;

                console.log(fs);

                console.log("each");

                console.log($(fs).length);

                $(fs).each(function () {
                    console.log(this.name);
                    $('#list').append(this.name + "---" )
                });

                //console.log($('#files').files[0]);
            });


            $('#del').click(function () {
                alert("del");
                var fs = $('#files').get(0).files;
                $(fs).splice(1, 1);
                console.log($(fs));
            });

        });
    </script>
}